import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;


public class ScriptSample3 {

	static final String FILE_NAME = "sample.js";
	/**
	 * @param args
	 * @throws ScriptException 
	 */
	public static void main(String[] args) {
		ScriptEngine engine = new ScriptEngineManager().getEngineByExtension("js");
		try {
			BufferedReader reader = new BufferedReader(new FileReader(FILE_NAME));
			engine.put(ScriptEngine.FILENAME, FILE_NAME);
			engine.eval(reader);
		} catch (FileNotFoundException e) {
			System.err.println("ဖော်ပြထားသော ဖိုင်ကိုရှာမတွေ့ပါ။");
		} catch (ScriptException e) {
			System.err.println("Script ဘာသာရပ်၏ အမှားဖြစ်၏။");
		}
	}

}
